import request from '@/utils/request'

const api_name = '/admin/product/categoryBrand'

// 分页列表
export const GetCategoryBrandPageList = (pageNum, pageSize,categoryId,brandId) => {
    return request({
        url: '/admin/product/categoryBrand/page',
        method: 'post',
        data: {
            pageNum,
            pageSize,
            categoryId,
            brandId
          }
    })
}

//删除
export const DeleteCategoryBrandById = (id) => {
    return request({
        url: `${api_name}/remove/${id}`,
        method: 'delete',
    })
}


//新增
export const AddCategoryBrand = (brandId,categoryId) => {
    return request({
        url: `${api_name}/add`,
        method: 'post',
        data:{
            brandId,
            categoryId
        }
    })
}

//修改
export const UpdateCategoryBrand = (id,brandId,categoryId) => {
    return request({
        url: `${api_name}/update`,
        method: 'post',
        data:{
            id,
            brandId,
            categoryId
        }
    })
}

// 根据分类ID查找品牌
export const getBrandByCategoryId = categoryId => {
    return request({
        url: `${api_name}/get/brand/${categoryId}`,
        method: 'GET'
    })
}


// 根据分类ID查找父类id
export const getCategoryByBrandId = categoryId => {
    return request({
        url: `${api_name}/get/categoryParentID/${categoryId}`,
        method: 'GET'
    })
}
